import dayjs from 'dayjs'

export function formatMonthDay(date, formatStr = "MM月DD日") {
  return dayjs(date).format(formatStr)
}

export function getDiffDays(startDate, endDate) {
  return dayjs(endDate).diff(startDate, "day")
}

export function getDay(day) {
  let type = {
    0: '周日',
    1: '周一',
    2: '周二',
    3: '周三',
    4: '周四',
    5: '周五',
    6: '周六',
  }
  return type[new Date(day).getDay()]
}

export function getCountdown(time) {
  return Math.floor(time / 60)
}